bitkeeper revision 1.1159.73.1 (413de483EcoXREVUizJpurRwrbzoLA)
authorcl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>
Tue, 7 Sep 2004 16:40:35 +0000 (16:40 +0000)
committercl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>
Tue, 7 Sep 2004 16:40:35 +0000 (16:40 +0000)
Fast-path pagetable updates which change a mapping from writable to readonly.

xen/arch/x86/memory.c

index df5ad0004b26c7bc4a84b2c790420dd35255a56b..469b5a08eaaaa6bafb2dc9cb526c1ac8d34cac18 100644 (file)
@@ -380,6 +380,19 @@ get_linear_pagetable(
 }
 
 
+static inline int
+readonly_page_from_l1e(
+    l1_pgentry_t l1e)
+{
+    struct pfn_info *page = &frame_table[l1_pgentry_to_pagenr(l1e)];
+    unsigned long    l1v  = l1_pgentry_val(l1e);
+
+    if ( !(l1v & _PAGE_PRESENT) || !pfn_is_ram(l1v >> PAGE_SHIFT) )
+        return 0;
+    put_page_type(page);
+    return 1;
+}
+
 static int
 get_page_from_l1e(
     l1_pgentry_t l1e, struct domain *d)
@@ -1540,6 +1553,11 @@ void ptwr_reconnect_disconnected(unsigned long addr)
         nl1e = pl1e[i];
         if (likely(l1_pgentry_val(nl1e) == l1_pgentry_val(ol1e)))
             continue;
+        if (likely(l1_pgentry_val(nl1e) == (l1_pgentry_val(ol1e) | _PAGE_RW)))
+        {
+            if (likely(readonly_page_from_l1e(nl1e)))
+                continue;
+        }
         if (unlikely(l1_pgentry_val(ol1e) & _PAGE_PRESENT))
             put_page_from_l1e(ol1e, current);
         if (unlikely(!get_page_from_l1e(nl1e, current))) {